/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSkyRoom.finder;

import ru.jSkyRoom.interfaces.stub.StubMajor;
import skyproc.FormID;

/**
 *
 * @author Rakev
 */
public abstract class FinderByFormIDStub<T extends StubMajor> extends AbstractFinderByFormId<T> {

    @Override
    public T find(FormID id) {
        if (isNullFormId(id)) {
            return null;
        }
        return createStub(id);
    }

    protected abstract T createStub(FormID id);

    private boolean isNullFormId(FormID id) {
        return id == null || id.isNull() || id.toString().startsWith("000000");
    }

}
